<!-- Search -->
<app-search-bar
  [submitLoading]="tableParams.loading"
  labelFlex="85px"
  [searchOptions]="searchOptions"
  (onSearch)="queryResetData($event)"
  (onReset)="queryResetData($event)"
>
</app-search-bar>

<nz-card class="m-t-4">
  <div class="pagination-wrap-position table-wrap">
    <nz-table
      #basicTable
      nzSize="small"
      nzShowSizeChanger
      nzShowQuickJumper
      nzOuterBordered
      [nzFrontPagination]="false"
      [nzLoadingDelay]="100"
      [nzLoading]="tableParams.loading"
      [nzData]="tableParams.tableData"
      [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
      [nzTotal]="tableParams.total"
      [nzPageIndex]="tableParams.page"
      [nzPageSize]="tableParams.pageSize"
      [nzShowTotal]="totalTemplate"
      (nzPageIndexChange)="onPageIndexChange($event)"
      (nzPageSizeChange)="onPageSizeChange($event)"
    >
      <thead>
        <tr>
          <th nzAlign="center" nzWidth="120px">ID</th>
          <th nzAlign="center">收支类型</th>
          <th nzAlign="center">发生时间</th>
          <th nzAlign="center">明细</th>
          <th nzAlign="center">爱豆抵扣</th>
          <th nzAlign="center">支付方式</th>
          <th nzAlign="center">支付金额</th>
          <th nzAlign="center">交易流水</th>
        </tr>
      </thead>

      <tbody>
        <tr *ngFor="let data of basicTable.data; let index = index;">
          <!-- ID -->
          <td nzAlign="center">{{ data.id }}</td>
          <!-- 收支类型 -->
          <td nzAlign="center">
            {{ data.changeType | machineScoreTypes }}
          </td>
          <!-- 发生时间 -->
          <td nzAlign="center">{{ data.createTime || '-' }}</td>
          <!-- 明细 -->
          <td nzAlign="center">
            <span [ngStyle]="{'color': data.frequency > 0 ? '#67C23A' : '#F56C6C'}">
              {{ data.frequency > 0 ? '+' + data.frequency : (data.frequency || '0') }}
            </span>
          </td>
          <!-- 爱豆抵扣 -->
          <td nzAlign="center">{{ data.amount || '0' }}</td>
          <!-- 支付方式 -->
          <td nzAlign="center">
            <div [ngSwitch]="data.withdrawalType">
              <div *ngSwitchCase="1">支付宝</div>
              <div *ngSwitchCase="2">微信</div>
              <div *ngSwitchCase="3">银联</div>
              <div *ngSwitchDefault>-</div>
            </div>
          </td>
          <!-- 支付金额 -->
          <td nzAlign="center">{{ data.realPay || '0' }}</td>
          <!-- 交易流水 -->
          <td nzAlign="center">
            {{ (data.billNo && data.billNo !== '0') ? data.billNo : '-' }}
          </td>
        </tr>
      </tbody>
    </nz-table>

    <!-- 分页template -->
    <ng-template #totalTemplate let-total>共有 {{ total }} 条</ng-template>
  </div>

  <nz-divider></nz-divider>
  <app-bt-group [btType]="'default'" [btText]="'返回'"></app-bt-group>
</nz-card>